<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>   
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset=UTF-8>
		<title>活动</title>
	    <base href="<%=basePath%>">
		<link rel="stylesheet" type="text/css" href="bootstrap-rs/themes/black/easyui.css">
		<link rel="stylesheet" type="text/css" href="bootstrap-rs/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="bootstrap-rs/demo.css">
		<script type="text/javascript" src="bootstrap-rs/jquery.min.js"></script>
		<script type="text/javascript" src="bootstrap-rs/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="bootstrap-rs/src/jquery.form.js"></script>
		
		<style type="text/css">
			.netText{
				color:white;
				margin:0px 0px 0px 5px;
			}
		</style>
		
		<script type="text/javascript">
			function cx(){			  
			  $('#dg').datagrid('reload',{
			  		name:$('#name').val(),
			  		manager:$('#manager').val(),
			  		netLevel:$('#netLevel').val(),
					serviceType:$('#serviceType').val(),
					checkStatus:$('#checkStatus').val(),
					cancelStatus:$('#cancelStatus').val() 		
			  	})
			}
			
			$(function(){
				$('#dg').datagrid({
			        url:'/club/net/pageQuery',
			        columns:[[
			        	{field:'ck',checkbox:'true'},
			    		{field:'name',title:'网点名称',width:100,align:'center'},
			    		{field:'address',title:'网点地址',width:100,align:'center'},
			    		{field:'phone',title:'网点电话',width:100,align:'center'},
			    		{field:'manager',title:'管理员',width:100,align:'center'},
			    		{field:'nLevel',title:'网点级别',width:100,align:'center'},
			    		{field:'nType',title:'服务类型',width:100,align:'center'},
			    		{field:'checkStatus',title:'审核状态',width:100,align:'center'},
			    		{field:'cancelStatus',title:'注销状态',width:100,align:'center'}
			        ]],
			        //fit:'true',
			        fitColumns:'true',
			        striped:'true',
			        //pagination:'true',//是否开启分页
			        //pagePosition:'bottom',//分页栏的位置
			        //pageNumber:'1',//默认第几页
			        //pageSize:'10',//默认每页显示10个
			        //pageList:[10,20,30],//每页记录条数的列表
			        singleSelect:'true',
			        checkOnSelect:'true',
			        toolbar: [
			        	{
						iconCls: 'icon-add',
						text:'新增',
						handler: function(){
							//window.location.href="club/activity/toAdd"
							$('#dlg').dialog('open').dialog('setTitle','新增网点信息');
							$('#fm').form('clear');
						}},
			        '-',{
						iconCls: 'icon-edit',
						text:'查看',
						handler: function(){
								var cbs = $('#dg').datagrid('getSelections');
								if(cbs.length==0){
									alert('请选择其中一个网点！');
								}
								window.location.href="club/net/viewDetail?id="+cbs[0].id;
							}
						},
					'-',{
						iconCls: 'icon-remove',
						text:'编辑',
						handler: function(){
								var cbs = $('#dg').datagrid('getSelections');
								if(cbs.length==0){
									alert('请选择其中一个网点！');
								}
								window.location.href="club/net/toUpdate?id="+cbs[0].id;						
							}
						},
					'-',{
						iconCls: 'icon-help',
						text:'审核',
						handler: function(){
								var cbs = $('#dg').datagrid('getSelections');
								if(cbs.length==0){
									alert('请选择其中一个网点！');
								}
								window.location.href="club/net/toCheck?id="+cbs[0].id;						
							}
						},
					'-',{
						iconCls: 'icon-cancel',
						text:'删除',
						handler: function(){
								var cbs = $('#dg').datagrid('getSelections');
								if(cbs.length==0){
									alert('请选择其中一个网点！');
								}else{
									$.messager.confirm('Confirm','确定要删除该网点信息吗？',function(r){
										if(r){
											window.location.href="club/net/del?id="+cbs[0].id;						
										}
									})
								}
							}
						}
					]
			});
		
		//结尾
		});
		</script>
	</head>
	<body>		
		<div style="margin:0px 0px 10px 0px;">
			<label class="netText">网点名称: </label>
			<input id="name" type="text" name="name" class="easyui-textbox" >
			<label class="netText">管理员：</label>
			<input id="manager" type="text" name="manager" class="easyui-textbox" >
			<label class="netText">网点级别：</label>
			<select id="netLevel" name="netLevel" class="easyui-combobox" panelHeight="auto" style="width:100px">
					<option value="">请选择级别</option>
				<c:forEach items="${levels}" var="level">
					<option value="${level.typeid}" ${condition.netLevel eq level.typeid?'selected':''}>${level.typename}</option>
				</c:forEach>
			</select>
			<label name="serviceType" class="netText">服务类型：</label>
			<select id="serviceType" class="easyui-combobox" panelHeight="auto" style="width:100px">
				<option value="">请选择类型</option>
				<c:forEach items="${types}" var="type">
					<option value="${type.typeid}" ${condition.serviceType eq type.typeid?'selected':''}>${type.typename}</option>
				</c:forEach>		
			</select>
			<label class="netText">审核状态：</label>
			<select id="checkStatus" name="checkStatus" class="easyui-combobox" panelHeight="auto" style="width:100px">
				<option value="">请选择</option>
				<c:forEach items="${checks}" var="check">
					<option value="${check.typename}" ${condition.checkStatus eq check.typename?'selected':''}>${check.typename}</option>
				</c:forEach>
			</select>
			<label class="netText">注销状态：</label>
			<select id="cancelStatus" name="cancelStatus" class="easyui-combobox" panelHeight="auto" style="width:100px">
				<option value="">请选择</option>
				<c:forEach items="${cancels}" var="cancel">
					<option value="${cancel.typename}" ${condition.cancelStatus eq cancel.typename?'selected':''}>${cancel.typename}</option>
				</c:forEach>	
			</select>
			<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" style="margin:0px 15px;" onclick="javascript:cx()">查询</a>
		</div>
		<table id="dg" class="easyui-datagrid"></table>
		    <div id="dlg" class="easyui-dialog" style="width:600px;height:480px;padding:10px 20px"
    		closed="true" buttons="#dlg-buttons">
    	<div class="ftitle"></div>
	    	<form id="fm" method="post" action="">
	    		<div class="fitem">
				<table>
					<tr>
						<td>网点名称：</td>
						<td>
							<input type="text" name="name" class="easyui-validatebox easyui-textbox">
						</td>
					</tr>
					<tr>
						<td>网点电话：</td>
						<td>
							<input type="text" name="phone">
						</td>
					</tr>				
					<tr>
						<td>管理员：</td>
						<td>
							<input type="text" name="manager">
						</td>
					</tr>
					<tr>
						<td>网点级别：</td>
						<td>
							<select name="netLevel">
								<c:forEach items="${levels}" var="level">
									<option value="${level.typeid}">${level.typename}</option>
								</c:forEach>
							</select>
						</td>
					</tr>		
					<tr>
						<td>服务类型：</td>
						<td>
							<select name="serviceType">
								<c:forEach items="${types}" var="type">
									<option value="${type.typeid}">${type.typename}</option>
								</c:forEach>
							</select>					
						</td>
					</tr>						
					<tr>
						<td>网点地址：</td>
						<td>
							<textarea rows="5" cols="30" name="address"></textarea>
						</td>
					</tr>
					<tr>
						<td>服务内容：</td>
						<td>
							<textarea rows="5" cols="30" name="serviceContent"></textarea>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<input type="submit" value="提交">
							<input type="reset" value="重置">
						</td>
					</tr>																
			</table>
			</form>
	    	<div id="dlg-buttons">
			    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="javascript:add()">新增</a>
			    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
			</div>
		</div> 
	</body>
</html>